User's Post count from specific category [Wordpress]

Posted by morningglory on Stack Overflow See other posts from Stack Overflow or by morningglory
Published on 2010-04-26T11:10:08Z Indexed on 2010/04/26 11:13 UTC
Read the original article Hit count: 171

Filed under:
|
|

Hello,

I want to show user's post count from specific category. Currently, I can only be able to query all posts. My code is like this

<?php $userpost_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type ='post' AND post_author = '".$curauth->ID."'");?>
<?php echo "<span>Total post: </b></span>".$userpost_count.""?>

I know that, I need to join two table which is post table and term_relationships, but i don't know how to get it. Please kindly help me with that. Thank you.

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about php